<blockquote>
    <p>SqlMap插件 @@EnableSQLMapPlugin 注解</p>
    <footer>
        <p><code>String value</code>: 指定Sql Xml配置目录</p>
        <p><code>String hump</code>: 是否将数据库字段转成驼峰, 默认false</p>
    </footer>
</blockquote>
<blockquote>
    <p>例如 <code>@EnableSQLMapPlugin(value = "com/acxy/idleegg/mapper")</code></p>
    <footer>Entity Mapper SqlXml生成工具 <a href="javascript:;" target="_blank">下载地址</a></footer>
    <footer>后期有时间会制作idea跳转插件, 从接口直接跳转到配置...</footer>
</blockquote>
<blockquote>
    <p>示例 Mapper接口定义</p>
    <footer style="color:red;">@Mapper 注解标识当前是SqlMap需要绑定的接口 @Mapper(可以指定数据源)</footer>
</blockquote>
<pre class="code brush:java">
package com.acxy.idleegg.mapper;


import cn.jants.plugin.sqlmap.annotation.Mapper;
import cn.jants.plugin.sqlmap.annotation.P;
import com.acxy.idleegg.entity.Member;

import java.util.List;

/**
 * @author MrShun
 * @version 1.0.0
 * @Date 2018-02-02
 */
@Mapper
public interface MemberMapper {

    /**
     * 查询会员列表
     *
     * @return
     */
    List&lt;Member> selectList();

    /**
     * 根据openId查询用户信息
     *
     * @param openId 用户openId
     * @return
     */
    Member selectByOpenId(String openId);


    /**
     * 新增会员数据
     *
     * @param member 实体对象
     * @return
     */
    Long insert(Member member);

    /**
     * 修改会员信息
     *
     * @param member 实体对象
     * @return
     */
    Integer updateByOpenId(Member member);

    /**
     * 删除会员信
     *
     * @param openId
     * @return
     */
    Integer deleteByOpenId(String openId);

    /**
     * 参数超过2个的时候, 需要进行参数绑定
     *
     * @param openId
     * @param type
     * @return
     */
    Integer deleteByOpenId(@P("openId")String openId, @P("type")Integer type);
}
</pre>
<blockquote>
    <p>示例 Sql Xml配置</p>
    <footer style="color:red;">命名空间必须和接口名称一致</footer>
</blockquote>
<pre class="code brush:xml">
&lt;?xml version="1.0" encoding="UTF-8" ?>
&lt;!DOCTYPE mapper PUBLIC "ANTS" "http://doc.jants.cn/dtd/ants-mapper.dtd" >
    <!-- 用户-->
<mapper namespace="MemberMapper" >

    <resultType id="member" type="com.acxy.idleegg.entity.Member" />


    <!--数据和实体的对应映射-->
    <sql id="Base_Column_List" >
        open_id as openId,
        account as account,
        nick_name as nickName,
        sex as sex,
        avatar as avatar,
        tel as tel,
        email as email,
        birthday as birthday,
        is_lock as isLock,
        type as type,
        create_time as createTime
    </sql>

    <!-- //TODO 多条件查询,自己扩充条件 -->
    <select id="selectList" resultType="member">
        select <include refid="Base_Column_List"/> from member
    </select>

    <!-- //TODO 多条件删除,自己扩充条件-->
    <delete id="deleteByOpenId">
        delete from member where open_id = #{openId}
    </delete>


    <!-- 根据主键ID查询一条记录-->
    <select id="selectById">
        select <include refid="Base_Column_List"/> from member where id = #{id}
    </select>

    <!-- 插入不为空的字段 -->
    <insert id="insert">
        insert into member
        <trim prefix="(" suffix=")" suffixOverrides="," >
            <if test="id != null" >
                id,
            </if>
            <if test="openId != null" >
                open_id,
            </if>
            <if test="account != null" >
                account,
            </if>
            <if test="nickName != null" >
                nick_name,
            </if>
            <if test="sex != null" >
                sex,
            </if>
            <if test="avatar != null" >
                avatar,
            </if>
            <if test="tel != null" >
                tel,
            </if>
            <if test="email != null" >
                email,
            </if>
            <if test="birthday != null" >
                birthday,
            </if>
            <if test="isLock != null" >
                is_lock,
            </if>
            <if test="type != null" >
                type,
            </if>
            <if test="createTime != null" >
                create_time,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
            <if test="id != null" >
                #{id},
            </if>
            <if test="openId != null" >
                #{openId},
            </if>
            <if test="account != null" >
                #{account},
            </if>
            <if test="nickName != null" >
                #{nickName},
            </if>
            <if test="sex != null" >
                #{sex},
            </if>
            <if test="avatar != null" >
                #{avatar},
            </if>
            <if test="tel != null" >
                #{tel},
            </if>
            <if test="email != null" >
                #{email},
            </if>
            <if test="birthday != null" >
                #{birthday},
            </if>
            <if test="isLock != null" >
                #{isLock},
            </if>
            <if test="type != null" >
                #{type},
            </if>
            <if test="createTime != null" >
                #{createTime},
            </if>
        </trim>
    </insert>

    <!-- 根据主键Id删除数据-->
    <delete id="deleteById">
        delete from member where id = #{id}
    </delete>

    <!-- 据主键Id修改字段不为空的数据 -->
    <update id="updateByOpenId">
        update member
        <set>
            <if test="account != null" >
            account = #{account},
            </if>
            <if test="nickName != null" >
            nick_name = #{nickName},
            </if>
            <if test="sex != null" >
            sex = #{sex},
            </if>
            <if test="avatar != null" >
            avatar = #{avatar},
            </if>
            <if test="tel != null" >
            tel = #{tel},
            </if>
            <if test="email != null" >
            email = #{email},
            </if>
            <if test="birthday != null" >
            birthday = #{birthday},
            </if>
            <if test="isLock != null" >
            is_lock = #{isLock},
            </if>
            <if test="type != null" >
            type = #{type},
            </if>
            <if test="createTime != null" >
            create_time = #{createTime},
            </if>
        </set>
        where open_id = #{openId}
    </update>

    <select id="selectByOpenId">
        select <include refid="Base_Column_List"/> from member where open_id = #{openId} limit 1
    </select>
</mapper>
</pre>
<script type="text/javascript">
    $(function () {
        SyntaxHighlighter.highlight();
        $(".toolbar").remove();
    });
</script>